var t = require("../../../../@babel/runtime/helpers/typeof"), e = getApp();

Page({
    data: {
        language: "",
        lecturer_name: "",
        avatar: "",
        order_bonus: "0.00",
        reward_bonus: "0.00",
        lecturer_bonus: "0.00",
        activeName: "first",
        active: 0,
        first_content: [],
        second_content: [],
        third_content: [],
        currentTabIndex: "0",
        is_first_content: !1,
        is_second_content: !1,
        is_third_content: !1
    },
    onLoad: function(t) {
        this.checkrouter(), this.getLecturerInfo(), this.setDataByTabIndex();
    },
    checkrouter: function() {
        try {
            var e = function() {
                for (var t = wx.getStorageSync("yz_basic_info"), e = t.popularize_page.mini.vue_route, n = 0; n < e.length; n++) if ("courseIncome" == e[n]) return console.log(t.popularize_page.mini.mini_url + "跳转的路径"), 
                wx.showToast({
                    title: "未开启推广权限",
                    duration: 1e3,
                    icon: "none",
                    success: function() {
                        setTimeout(function() {
                            wx.redirectTo({
                                url: t.popularize_page.mini.mini_url
                            });
                        }, 1e3);
                    }
                }), {
                    v: void 0
                };
            }();
            if ("object" === t(e)) return e.v;
        } catch (t) {
            console.log(t);
        }
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getLecturerInfo: function() {
        var t = this, n = e.getNetAddresss("plugin.video-demand.api.video-demand-lecturer.get-lecturer-info");
        e._getNetWork({
            url: n,
            success: function(e) {
                var n = e.data;
                1 == n.result ? t.setData({
                    lecturer_name: n.data.lecturer_name,
                    avatar: n.data.avatar,
                    order_bonus: n.data.order_bonus,
                    reward_bonus: n.data.reward_bonus,
                    lecturer_bonus: n.data.lecturer_bonus
                }) : wx.showToast({
                    icon: "none",
                    title: n.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    setDataByTabIndex: function() {
        "0" != this.data.currentTabIndex || this.data.is_first_content ? "1" != this.data.currentTabIndex || this.data.is_second_content ? "2" != this.data.currentTabIndex || this.data.is_third_content || (this.setData({
            is_third_content: !0
        }), this.getLecturerBonusInfo("1")) : (this.setData({
            is_second_content: !0
        }), this.getLecturerBonusInfo("0")) : (this.setData({
            is_first_content: !0
        }), this.getLecturerBonusInfo(""));
    },
    getLecturerBonusInfo: function(t) {
        var n = this, a = e.getNetAddresss("plugin.video-demand.api.video-demand-lecturer.lecturer-reward-info");
        e._getNetWork({
            url: a,
            success: function(t) {
                var e = t.data;
                if (1 == e.result) switch (n.data.currentTabIndex) {
                  case "0":
                    n.setData({
                        first_content: e.data
                    });
                    break;

                  case "1":
                    n.setData({
                        second_content: e.data
                    });
                    break;

                  case "2":
                    n.setData({
                        third_content: e.data
                    });
                } else wx.showToast({
                    icon: "none",
                    title: e.msg,
                    duration: 1500
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    handleClick: function(t) {
        var e = t.detail.index;
        this.data.currentTabIndex != e && (this.setData({
            currentTabIndex: e
        }), this.setDataByTabIndex());
    }
});